function ManageSchoolManagerCtrl($scope, $http, $state) {
	
	$scope.isRetypeSame=false;
	$scope.isRetypeDiff=false;
	$scope.isRetypeSame=function(){
        if($scope.retypePassword==$scope.password){
        	$scope.isRetypeDiff=false;
        }else{
        	$scope.isRetypeDiff=true;
        }
    }

    //FIXME pagination
    $scope.getAllSchoolManager = function() {
        $http({
            url: 'user/getAllSchoolManager',
            method: 'get',
        }).success(function (response) {
            $scope.list = response;
            console.log($scope.list)
        })
    };

//    //FIXME dangerous operation, add model
//    $scope.delete = function (uid) {
//        $http({
//            url: 'user/delete',
//            method: 'delete',
//            params: {
//                uid: uid
//            }
//        }).success(function (response) {
//            location.reload();
//        })
//    };

    //删除记录
    $scope.delete = function(uid) {
    	$scope.uid = uid;
        $('#sure').modal();
    }
    
    $scope.submits = function(val) {
        if (val == "delete") {
        	$http({
                url: 'user/delete',
                method: 'delete',
                params: {
                    uid: $scope.uid
                }
            }).success(function (response) {
                location.reload();
            })
        } else if (val == "cancel") {
            $('.close').click();
        }
    }

    $scope.addSchoolManager = function () {
        console.log($scope.username);
        $http({
            url: 'user/addSchoolManager',
            method: 'post',
            // data: $('#addSchoolManagerForm').serialize(),
            params: {
                username: $scope.username,
                password: $scope.password,
                retypePassword: $scope.retypePassword,
                realName: $scope.realName
            }
        }).success(function (response) {
            $state.go('index.management.manageSchoolManager')
        })
    };
    
    $scope.getAllSchoolManager();
}

function ManageStudentCtrl($scope, $http) {

    //FIXME pagination
    $scope.getAllStudent = function() {
        $http({
            url: 'user/getAllStudent',
            method: 'get',
        }).success(function (response) {
            $scope.list = response;
        })
    };

//    //FIXME dangerous operation, add model
//    $scope.delete = function (uid) {
//        $http({
//            url: 'user/delete',
//            method: 'delete',
//            params: {
//                uid: uid
//            }
//        }).success(function (response) {
//            location.reload();
//        })
//    };

  //删除记录
    $scope.delete = function(uid) {
    	$scope.uid = uid;
        $('#sure').modal();
    }
    
    $scope.submits = function(val) {
        if (val == "delete") {
        	$http({
                url: 'user/delete',
                method: 'delete',
                params: {
                    uid: $scope.uid
                }
            }).success(function (response) {
                location.reload();
            })
        } else if (val == "cancel") {
            $('.close').click();
        }
    }
    
    $scope.getAllStudent();
}